package cn.org.spring.wechar.constant;

import org.springframework.context.annotation.Bean;

/**
 * 微信公众平台常量类
 */
public class WeCharConstant {
    public static final String CREATE_TIME = "CreateTime";
    public static final String CONTENT = "Content";
    public static final String FROM_USER_NAME = "FromUserName";
    public static final String TO_USER_NAME = "ToUserName";
    public static final String MSG_TYPE = "MsgType";
    public static final String MSG_ID = "MsgId";


    /**
     * 创建菜单URL
     */
    public static final String CREATE_MENU_URL = "https://api.weixin.qq.com/cgi-bin/menu/create?access_token=ACCESS_TOKEN";
    /**
     * 删除菜单URL
     */
    public static final String DELETE_MENU_URL = "https://api.weixin.qq.com/cgi-bin/menu/delete?access_token=ACCESS_TOKEN";

    /**
     * 模版服务相关-设置所属行业
     */
    public static final String SET_INDUSTRY = "https://api.weixin.qq.com/cgi-bin/template/api_set_industry?access_token=ACCESS_TOKEN";
    /**
     * 获取所属行业信息
     */
    public static final String GET_INDUSTRY = "https://api.weixin.qq.com/cgi-bin/template/get_industry?access_token=ACCESS_TOKEN";
    /**
     * 获取所有模版信息
     */
    public static final String GET_ALL_PRIVATE_TEMPLATE = "https://api.weixin.qq.com/cgi-bin/template/get_all_private_template?access_token=ACCESS_TOKEN";
    /**
     * 发送模版消息
     */
    public static final String TEMPLATE_SEND = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=ACCESS_TOKEN";
    /**
     * 获取OAUTH认证的access_token
     */
    public static final String OAUTH_GET_AT = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=APPID&secret=SECRET&code=CODE&grant_type=authorization_code";
    /**
     * 获取用户基本信息
     */
    public static final String OAUTH_USER_INFO = "https://api.weixin.qq.com/sns/userinfo?access_token=ACCESS_TOKEN&openid=OPENID&lang=zh_CN";

    /**
     * 引导链接
     */
    public static final String OAUTH2_AUTHORIZE = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=APPID&redirect_uri=REDIRECT_URI&response_type=code&scope=SCOPE&state=STATE#wechat_redirect";

    /*-----------------------------------------------------------------------------------------------------*/

    /**
     * 第三方平台component_access_token  ----->  第三方平台接口的调用凭据 用于后面获取预授权码
     *
     * 需要参数:
     *  component_appid          第三方平台 appid
     *  component_appsecret      第三方平台 appsecret
     *  component_verify_ticket  微信后台推送的 ticket
     */
    public static final String COMPONENT_ACCESS_TOKEN = "https://api.weixin.qq.com/cgi-bin/component/api_component_token";

    /**
     * 预授权码  ----->  用于后面的PC端授权
     *
     * component_access_token 第三方平台component_access_token
     */
    public static final String PRE_AUTH_CODE = "https://api.weixin.qq.com/cgi-bin/component/api_create_preauthcode?component_access_token=COMPONENT_ACCESS_TOKEN";

    /**
     * PC端授权链接  ----->  授权后返回刷新token
     *
     * 需要参数:
     *  component_appid 第三方平台方 appid
     *  pre_auth_code   预授权码
     *  redirect_uri    回调URI
     *  auth_type       授权的帐号类型 1则商户点击链接后，手机端仅展示公众号、2表示仅展示小程序，3表示公众号和小程序都展示。如果为未指定，则默认小程序和公众号都展示。第三方平台开发者可以使用本字段来控制授权的帐号类型。
     */
    public static final String PC_AUTH_LINK = "https://mp.weixin.qq.com/cgi-bin/componentloginpage?component_appid=xxxx&pre_auth_code=xxxxx&redirect_uri=xxxx&auth_type=xxx";

    /**
     * 授权得到用户的两个token  ----->  用户授权后 会在回调url中携带授权码authorization_code 通过component_access_token、component_appid、authorization_code
     */
    public static final String AUTHORIZER_REFRESH_TOKEN = "https://api.weixin.qq.com/cgi-bin/component/api_query_auth?component_access_token=COMPONENT_ACCESS_TOKEN";

    /**
     * authorizer_access_token过期后通过刷新token得到authorizer_access_token  -----> 得到authorizer_access_token
     */
    public static final String AUTHORIZER_ACCESS_TOKEN = "https://api.weixin.qq.com/cgi-bin/component/api_authorizer_token?component_access_token=COMPONENT_ACCESS_TOKEN";


}